<template>
  <div>
    <h2>用户列表</h2>
    <table>
      <thead>
        <tr>
          <th>ID</th>
          <th>用户名</th>
          <th>邮箱</th>
          <th>电话</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="user in users" :key="user.user_id">
          <td>{{ user.user_id }}</td>
          <td>{{ user.username }}</td>
          <td>{{ user.email }}</td>
          <td>{{ user.phone }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: 'UserList',
  data() {
    return {
      users: []
    };
  },
  mounted() {
    request.get('/admin')
      .then(res => this.users = res.data)
      .catch(err => console.error(err));
  }
}
</script>
